package com.turman.blibrary.log;

import androidx.annotation.NonNull;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * 日志管理类
 *
 * @author buobao
 * @since 2024/2/26 17:22
 */
public class BLogManager {
    private BLogConfig config;

    private ArrayList<BLogPrinter> printers = new ArrayList<>();
    private static BLogManager instance;

    private BLogManager(BLogConfig config, BLogPrinter[] printers) {
        this.config = config;
        if (printers != null && printers.length > 0) {
            this.printers.addAll(Arrays.asList(printers));
        }
    }

    public static BLogManager getInstance() {
        return instance;
    }

    public static void init(@NonNull BLogConfig config, BLogPrinter... printers) {
        instance = new BLogManager(config, printers);
    }

    public BLogConfig getConfig() {
        return config;
    }

    public List<BLogPrinter> getPrinters() {
        return printers;
    }

    public void addPrinters(BLogPrinter printer) {
        printers.add(printer);
    }
}
